<template>
	<view>
		<view class="setting-box">
			<u-cell-group>
				<u-cell title="隐私协议" :isLink="true" @click="jumpPage('/packMyself/agreement/agreement?id=1')"></u-cell>
				<u-cell title="用户协议" :isLink="true" @click="jumpPage('/packMyself/agreement/agreement?id=2')"></u-cell>
			</u-cell-group>
			<view class="null-box"></view>
		</view>
		<view class="u-m-t-60 u-p-60"><u-button @click="onLogout" type="error" :plain="true" text="退出登录"></u-button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	methods: {
		jumpPage(url) {
			uni.navigateTo({
				url
			});
		},
		// 退出登录
		onLogout() {
			uni.showModal({
				title: '提示',
				content: '确定退出登录',
				success: async res => {
					if (!res.confirm) return;
					const info = await this.$api.user.signOut();
					if (info.code == 200) {
						uni.clearStorageSync();
						uni.reLaunch({
							url: '/pages/login/login'
						});
					}
				}
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.setting-box {
	background: #fff;
	.null-box {
		height: 30rpx;
		background: #f9f9f9;
	}
}
</style>
